import {request,get,post} from '@/utils/request.js';

export const getNotes =(typeId,keyword)=>{
	return get('/note/list',
		{
			typeId:typeId, 
			keyword, 
		}
	)
}

export const saveNoteTitle =(title, content, typeId)=>{
	return post('/note/save',
		{
			title, 
			content, 
			typeId
		}
	)
}

export const getNoteByTid =(tid)=>{
	return get('/note/showById',
		{
			id:tid
		}
	)
}

export const addContent =(tid, content,typeId)=>{
	return post('/note/addContent',
		{
			tid, 
			content,
			typeId
		}
	)
}

export const recycleContentById =(cid)=>{
	return get(
		'/note/recycleContentById',
		{
			id:cid
		}
	)
}

/**
 * 删除笔记的标题、全部内容
 */
export const recycleTitleById =(cid)=>{
	return get(
		'/note/recycleTitleById',
		{
			id:cid
		}
	)
}


/**
 * 根据tid修改笔记的标题
 */
export const updateTitleById =(tid,title)=>{
	return post(
		'/note/updateTitleById',
		{
			tid,
			title
		}
	)
}

/**
 * 根据cid修改笔记的内容
 */
export const updateContentById =(cid,content)=>{
	return post(
		'/note/updateContentById',
		{
			cid,
			content
		}
	)
}

/**
 * 修改分类
 */
export const updateTypeById =(tid,typeId)=>{
	return post(
		'/note/updateTypeById',
		{
			tid,
			typeId
		}
	)
}
